package com.linsir.file.config;

import com.linsir.file.util.OssBootUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author ：linsir
 * @date ：Created in 2022/9/15 1:31
 * @description：OssConfiguration 配置
 * @modified By：
 * @version: 0.0.1
 */
@Configuration
public class OssConfiguration {

    @Value("${linsir.oss.endpoint}")
    private String endpoint;
    @Value("${linsir.oss.accessKey}")
    private String accessKeyId;
    @Value("${linsir.oss.secretKey}")
    private String accessKeySecret;
    @Value("${linsir.oss.bucketName}")
    private String bucketName;
    @Value("${linsir.oss.staticDomain}")
    private String staticDomain;


    @Bean
    public void initOssBootConfiguration() {
        OssBootUtil.setEndPoint(endpoint);
        OssBootUtil.setAccessKeyId(accessKeyId);
        OssBootUtil.setAccessKeySecret(accessKeySecret);
        OssBootUtil.setBucketName(bucketName);
        OssBootUtil.setStaticDomain(staticDomain);
    }
}
